package com.fa.map
{
	import flash.display.Shape;
	import flash.display.Sprite;

	public class Map extends Sprite
	{
		public static var TILE_SIZE:Number = 10;
		public static var ROW:int = 50;
		public static var COL:int = 50;
		
		private var mapBackground:Shape;
		private var gridLine:Shape;
		
		public function Map()
		{
			initBackGround();
			initGridline();
		}
		
		private function initBackGround():void
		{
			mapBackground = new Shape();
			mapBackground.graphics.beginFill(0xFF0000, 1);
			mapBackground.graphics.drawRect(0, 0, COL * TILE_SIZE, ROW * TILE_SIZE);
			addChild(mapBackground);
		}
		
		private function initGridline():void
		{
			gridLine = new Shape();
			gridLine.graphics.lineStyle(1, 0x00FF00);
			for (var i:int = 0; i < ROW; i++) 
			{
				gridLine.graphics.moveTo(0, TILE_SIZE * i);
				gridLine.graphics.lineTo(TILE_SIZE * ROW, TILE_SIZE * i);
			}
			
			for(var j:int = 0; j < COL; j++)
			{
				gridLine.graphics.moveTo(TILE_SIZE * j, 0);
				gridLine.graphics.lineTo(TILE_SIZE * j, TILE_SIZE * COL);
			}
			addChild(gridLine);
		}
	}
}